class Stack {
	constructor() {
		this.every = {};
		this.count = 0;
	}
	push(element) {//添加元素
		this.every[this.count] = element;
		this.count++;
	}
	isEmpty() {//是否为空
		return this.count === 0;
	}
	pop() {//移除栈顶的元素
		if (this.isEmpty()) {
			return undefined;
		}
		this.count--;
		const result = this.every[this.count];
		delete this.every[this.count];
		return result;
	}
	peek() {//返回栈顶的元素
		if (this.isEmpty()) {
			return undefined;
		}
		return this.every[this.count--];
	}
	clear() {//移除栈里的所有元素
		this.every = {};
		this.count = 0;
	}
	size() {
		return this.count;
	}
}
const s = new Stack();
let  character = "";
function transform(count) {//进制转换 十进制转二进制
	let result = Math.floor(count / 2);
	s.push(count % 2);
	 character = `${s.pop()}${ character}`;
	if (result !== 0) {
		transform(result);
	}
	return  character;
}
console.log(transform(10))